
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>9、Spring Boot Actuator - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>9、Spring Boot Actuator - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Spring Boot Actuator 的主要功能是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它是一组为 Spring Boot 应用提供的生产环境监控功能，提供了许多关键指标、健康检查、应用状态等信息，旨在帮助开发者更好地运维和监控应用。</div>
          </div>
          <div class="card-source">来源: 文档开篇部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Spring Boot Actuator 的核心实现机制是基于什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">其核心实现是通过扫描和注册带有 `@Endpoint` 注解的类来完成的，同时它还依赖于 Spring Boot 的自动配置机制来加载和配置各个端点。</div>
          </div>
          <div class="card-source">来源: 1. Spring Boot Actuator 概述</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在健康检查端点（/actuator/health）的实现中，`HealthIndicatorRegistry` 的作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`HealthEndpoint` 通过注入 `HealthIndicatorRegistry`，后者负责管理和聚合从各个健康指示器（HealthIndicator）获取的应用健康指标，并最终返回整体的健康状态。</div>
          </div>
          <div class="card-source">来源: 2.2 健康检查端点（/actuator/health）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">度量指标端点（/actuator/metrics）是如何收集各种性能指标的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">其实现类 `MetricsEndpoint` 通过注入 `MeterRegistry`（Spring Boot 的度量库）来收集各种指标。当端点被调用时，它会通过 `meterRegistry.getMeters()` 获取所有已注册的度量指标。</div>
          </div>
          <div class="card-source">来源: 2.3 度量指标端点（/actuator/metrics）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">哪个类是 Actuator 自动配置的核心？它是如何工作的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">核心类是 `EndpointAutoConfiguration`。它负责将所有使用 `@Endpoint` 注解标注的类自动注册到 Spring 容器中。它通过 `@Import(EndpointConfiguration.class)` 导入配置来完成具体的端点实例化和注册。</div>
          </div>
          <div class="card-source">来源: 3.1 自动配置的核心类</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Spring Boot Actuator 是如何将 HTTP 请求映射到具体端点进行处理的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring Boot 使用 `EndpointHandlerMapping` 来处理端点请求。这个类负责将传入的 HTTP 请求映射到具体的端点实例，并调用其处理逻辑。</div>
          </div>
          <div class="card-source">来源: 3.2 端点注册</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">如何创建一个自定义的 Actuator 端点？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">开发者需要创建一个类，使用 `@Component` 和 `@Endpoint` 注解进行标注，并继承 `AbstractEndpoint`。然后实现 `invoke()` 方法来定义该端点的响应逻辑。</div>
          </div>
          <div class="card-source">来源: 4.1 自定义端点</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">如何为 Actuator 的健康检查功能添加一个自定义的检查项？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">开发者需要创建一个实现 `HealthIndicator` 接口的类，并将其注册为 Spring Bean。在该类中实现 `health()` 方法，并返回一个表示自定义健康检查状态的 `Health` 对象。</div>
          </div>
          <div class="card-source">来源: 4.2 自定义健康指示器</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">配置</div>
          <div class="card-question">如何通过配置文件将 `/actuator/health` 端点的访问路径修改为 `/actuator/healthcheck`？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">配置</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以在 `application.properties` 或 `application.yml` 文件中设置 `management.endpoints.web.path-mapping.health=healthcheck` 来修改健康检查端点的默认路径。</div>
          </div>
          <div class="card-source">来源: 5. Spring Boot Actuator 的配置与使用 - 设置端点的访问路径</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
